package com.mdx.order.controller;

import com.mdx.common.base.CommonResponse;
import com.mdx.order.annotation.CurrentLocalUser;
import com.mdx.order.annotation.LogMethod;
import com.mdx.order.entity.CurrentUser;
import com.mdx.order.resolver.LoginManagerHandlerMethodArgumentResolver;
import com.mdx.order.service.OrderService;
import com.mdx.order.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 测试注解获取用户信息
 * @author : jiagang
 * @date : Created in 2022/7/1 18:42
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    private static final Logger LOG = LoggerFactory.getLogger(TestController.class);

    /**
     * 测试接口
     * @param currentUser
     * @param commodityCode
     * @return
     */
    @PostMapping("createOrder")
    public CommonResponse<String> createOrder(@CurrentLocalUser CurrentUser currentUser, String commodityCode){
        LOG.info("当前用户信息：{}",currentUser);
        return CommonResponse.success();
    }

    /**
     * 测试接口
     * @return
     */
    @GetMapping("aopLog")
    public String aopLog(){
        testService.testLog();
        return "success";
    }
}
